# @File    : operate.py
# @Project : Airtest_JBL_IOS
from airtest.core.api import *


class OperateUtil:

    # def __init__(self, poco):
    #     self.poco = poco

    # # 元素定位
    # def location(self, timeout=None, name=None, text=None, resourceId=None):
    #     try:
    #         if name:
    #             return self.poco(name).wait(timeout)
    #         elif text:
    #             return self.poco(text=text).wait(timeout)
    #         elif resourceId:
    #             return self.poco(resourceId=resourceId).wait(timeout)
    #         elif name and text:
    #             return self.poco(name=name, text=text).wait(timeout)
    #         elif name and resourceId:
    #             return self.poco(name=name, resourceId=resourceId).wait(timeout)
    #         elif text and resourceId:
    #             return self.poco(text=text, resourceId=resourceId).wait(timeout)
    #         elif name and text and resourceId:
    #             return self.poco(name=name, text=text, resourceId=resourceId).wait(timeout)
    #     except PocoTargetTimeout:
    #         return None
    #
    # # 元素点击操作
    # def element_click(self, element_name, timeout):
    #     element = self.location(element_name, timeout)
    #     element.click()

    # 返回操作
    def back(self):
        keyevent("BACK")

    # 上拉状态栏
    def swipe_up(self):
        swipe((840, 2200), (840, 1330))

    # 下拉状态栏
    def swipe_down(self):
        swipe((840, 30), (840, 330))

    # # 获取屏幕宽(安卓)
    # def get_width(self):
    #     return G.DEVICE.display_info['width']
    #
    # # 获取屏幕高(安卓)
    # def get_height(self):
    #     return G.DEVICE.display_info['height']